package file;

import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;

public class PrintWriteDemo1 {
    public static void main(String[] args) {
        try(OutputStream outputStream = new FileOutputStream("D:/temp/d.txt")){
            OutputStreamWriter writer = new OutputStreamWriter(outputStream);
            PrintWriter printWriter = new PrintWriter(writer);
            printWriter.println("你好");
            printWriter.println("世界");
            printWriter.println("printwrite");
            printWriter.flush();//一定要刷新
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
